#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct {
    int id;
    char name[10];
} Student;

int main() {
    // 分配内存空间
    Student *p = (Student *)malloc(sizeof(Student));
    if (p == NULL) {
        printf("Failed to allocate memory.\n");
        return 1;
    }

    // 访问结构体成员
    p->id = 1;
    strcpy(p->name, "Tom");

    // 输出结构体成员
    printf("Student ID: %d\n", p->id);
    printf("Student Name: %s\n", p->name);

    // 释放内存空间
    free(p);
    p=NULL;
    
 
    return 0;
}
